<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<div class="header_top">
	<div class="container">
		<div class="header_top-box">
			<div class="header-top-left">
				
				<div class="clearfix"></div>
			</div>
			<div class="cssmenu">
				<ul>
					<s:if test="#session.loginUser == null">
					
						<li id="login"><a href="login.jsp">登陆</a></li>
						<li id="regist"><a href="regist.jsp">注册</a></li>
					</s:if>
					<s:else>
						<li class="active"><a href="userInforView">${session.loginUser.name}</a></li>
						<li class="active"><a href="userCart">购物车</a></li>
						<li class="active"><a href="" onclick="logout()">注销</a></li>
					</s:else>
					
				</ul>
			</div>
			<div class="clearfix"></div>
		</div>
	</div>
</div>
<div class="header_bottom">
	<div class="container">
		<div class="header_bottom-box">
			<div class="header_bottom_left">
				<div class="logo">
					<a href="index.jsp"><img src="images/logo.png" alt=""/></a>
				</div>
				<ul class="clock">
					<i class="clock_icon"> </i>
					<li class="clock_desc"></li>
				</ul>
				<div class="clearfix"> </div>
			</div>
			<div class="header_bottom_right">
				<div id="search" class="search" style="display:none">
					<input id="searchKey" name="searchKey" type="text" value="${session.searchKey }" placeholder="请输入关键字" onfocus="this.value = '';"/>
					<input id="searchSubmit" type="submit" onclick="search()" value=""/>
				</div>
			</div>
			<div class="clearfix"></div>
		</div>
	</div>
</div>
<script src="js/jquery.cookie.js"></script>
<script>
	function getNowFormatDate() {
	    var date = new Date();
	    var seperator1 = "-";
	    var seperator2 = ":";
	    var year = date.getFullYear();
	    var month = date.getMonth() + 1;
	    var strDate = date.getDate();
	    if (month >= 1 && month <= 9) {
	        month = "0" + month;
	    }
	    if (strDate >= 0 && strDate <= 9) {
	        strDate = "0" + strDate;
	    }
	    var currentdate = year + seperator1 + month + seperator1 + strDate;
	    return currentdate;
	}
	
	function logout(){
		if(confirm("是否要退出登陆？")){
			$.ajax({
				type:'post',
				url: "logout.action",
				data:{},
				dataType: "json",
				success: function(data){
					window.location.href = "<%=basePath%>/index.jsp"
				}
			})
		}
	}
	
	$(".clock_desc").html(getNowFormatDate());
</script>